package com.leaf.spring.y201907.day24.role;

import java.util.UUID;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 生产者
 * 
 * @Title:
 * @Description:
 * @Author: leaf
 * @Since:2019年7月25日
 * @Version:1.1.0
 */
@Component
public class Producer {

	@Autowired
	private RabbitTemplate rabbitTemplate;

	public void send(String message) {
		System.out.println("=============send");
		for (int i = 0; i < 100; i++) {
			rabbitTemplate.convertAndSend("leafExchange1", "direct.key", message + i, new CorrelationData(UUID.randomUUID().toString()));
		}
	}

}
